/* test_pad.cc
* This file is part of ncursesxx library
* Copyright (c) 2003,2004 by Stanislav Ievlev
*
* This file is covered by the GNU Library General Public License,
* which should be included with libncursesxx as the file COPYING.
*/
#include <iostream>

#include <ncurses/application.hh>
#include <ncurses/window.hh>
#include <ncurses/pen.hh>
#include <ncurses/color.hh>
#include <ncurses/pad.hh>

const int PAD_HIGH = 200;
const int PAD_WIDE = 200;
const int GRIDSIZE = 3;

int
main()
{
	ncurses::application	app;
	ncurses::window	win;
	ncurses::pad	pad;
	ncurses::pen	pen(pad);
	ncurses::color	blue(COLOR_WHITE, COLOR_BLUE);

	win.resize(30, 10);
	pad.resize(200, 200);
	pen.set_color(blue);

	unsigned int gridcount = 0;
	for (int i = 0; i < PAD_HIGH; i++)
	{
		for (int j = 0; j < PAD_WIDE; j++)
		{
			if ((0 == i % GRIDSIZE) && (0 == j % GRIDSIZE))
			{
				if ((0 == i) || (0 == j))
					pen.write("+");
				else
				{
					pen.write("A");
					gridcount++;
					//	pad.pen().write(static_cast<chtype>('A' + (gridcount++ % 26)));
				}
			}
			else if (0 == i % GRIDSIZE)
				pen.write("-");
			else if (0 == j % GRIDSIZE)
				pen.write("|");
			else
				pen.write(" ");
		}
	}

	pad.draw(win, 0, 2);
	
	::wrefresh(::stdscr); //made first screen refresh
	ncurses::pen(win).commit();
	::doupdate();
	
	::wgetch(::stdscr);
}
